package se392.ateam2006.utils;

import java.util.Calendar;
import java.util.GregorianCalendar;

/**
 * This class allows us to override the current date with another date, which is needed
 *      when running the FitNesse tests
 * @author Ateam (Matthew Bennett, Claire Melton, Shingai Manyiwa, John Adderley)
 * @version 25/03/07
 */
public class OveridableCalendar extends GregorianCalendar{
    
    // The date we're going to override
    // We may change this variable externally before initialising (hence 'static') when doing the FitNesse tests
    public static GregorianCalendar overriddenDate = null;
    
    /**
     * Creates a new instance of OveridableCalendar
     */
    public OveridableCalendar() {
        super();
        overide();
    }
    
    public static Calendar getInstance() {
        return new OveridableCalendar();
    }
    
    public void overide() {
        
        if(overriddenDate != null) {
            this.setTime(overriddenDate.getTime());            
        }
    }   
}
